package SoftWareTest;

public class FuncRevenueAccount1 {

    double FuncRevenueAccount(double amount) {
        double rate = 1.0; // 设置折扣率
        if (amount <= 800) // 若账单不高于800元，则无折扣
            rate = 1.0;
        else if (amount > 800 && amount <= 1800)
            rate = 0.9; // 9折
        else if (amount > 1800 && amount <= 4800)
            rate = 0.8; // 8折
        else if (amount > 4800)
            rate = 0.7; // 7折
        else if (amount <= 0) { // 否则，赋予一个负数，表示无效
            return -1000.0;
        }
        return amount * rate; // 返回经优惠计算之后的账单
    }

}